package mysql

import "gorm.io/gorm"

type Brand struct {
	gorm.Model
	Name string `gorm:"type:varchar(30);not null;comment:'品牌名称'"`
}

func (b *Brand) FindBrandByName(db *gorm.DB, name string) error {
	return db.Debug().Where("name=?", name).FirstOrCreate(b).Error
}

func (b *Brand) BrandShow(db *gorm.DB, id int64) error {
	return db.Debug().Where("id=?", id).Find(b).Error
}
